import Snippet from '~/components/snippet'
import Caption from '~/components/text/caption'
import { InlineCode } from '~/components/text/code'
import Note from '~/components/text/note'

export const meta = {
  editUrl: 'pages/docs/now-cli/now-cli-mdx/commands/logs.mdx',
  lastEdited: '2019-10-15T22:03:42.000Z'
}

## Logs

The `now logs` command is used to retrieve logs data for a specific deployment.

<Note type="warning">
  This command is for <b>advanced use only</b>. You can find more detailed logs
  on the Deployment Overview page from the ZEIT Dashboard.
</Note>

### Basic Usage

<Snippet dark text="now logs [deployment-url]" />
<Caption>Using the <InlineCode>now logs</InlineCode> command to retrieve logs for a specific deployment.</Caption>

### Global Options

The following [global options](#options) can be passed when using the `now logs` command:

- `--debug`
- `--global-config`
- `--help`
- `--local-config`
- `--scope`
- `--token`

For more information on global options and their usage, refer to the [options section](#options).

### Unique Options

These are options that only apply to the `now logs` command, therefore, more information is provided.

#### All

The `--all` option, shorthand `-a`, can be used to receive access logs in addition to the regular logs output.

##### Usage Example

<Snippet dark text="now logs --all" />
<Caption>Using the <InlineCode>now logs</InlineCode> command with the <InlineCode>--all</InlineCode> option.</Caption>

#### Follow

The `--follow` option, shorthand `-f`, can be used to watch for additional logs output.

##### Usage Example

<Snippet dark text="now logs --follow" />
<Caption>Using the <InlineCode>now logs</InlineCode> command with the <InlineCode>--follow</InlineCode> option.</Caption>

#### Number

The `--number` option, shorthand `-n`, can be used to specify the number of log lines to output.

##### Usage Example

<Snippet dark text="now logs --number 10" />
<Caption>Using the <InlineCode>now logs</InlineCode> command with the <InlineCode>--number</InlineCode> option.</Caption>

#### Output

The `--output` option, shorthand `-o`, can be used to specify the format of the logs output, this can be either `short` (default) or `raw`.

##### Usage Example

<Snippet dark text="now logs --output raw" />
<Caption>Using the <InlineCode>now logs</InlineCode> command with the <InlineCode>--output</InlineCode> option.</Caption>

#### Since

The `--since` option can be used to return logs only after a specific date, using the ISO 8601 format.

##### Usage Example

<Snippet dark text="now logs --since 2019-09-04T07:05:43+00:00" />
<Caption>Using the <InlineCode>now logs</InlineCode> command with the <InlineCode>--since</InlineCode> option.</Caption>

#### Query

The `--query` option, shorthand `-q`, can be used to return logs against a search query.

##### Usage Example

<Snippet dark text="now logs --query foo" />
<Caption>Using the <InlineCode>now logs</InlineCode> command with the <InlineCode>--query</InlineCode> option.</Caption>

#### Until

The `--until` option can be used to return logs only up until a specific date, using the ISO 8601 format.

##### Usage Example

<Snippet dark text="now logs --until 2019-09-04T07:05:43+00:00" />
<Caption>Using the <InlineCode>now logs</InlineCode> command with the <InlineCode>--until</InlineCode> option.</Caption>
